|
|
|
|
|
|
|
Figure 21.7
A list of employees that can be clicked on for editing. |
|
|
|
|
|
|
|
|
Examples Filename: Emps.frm |
|
|
|
|
|
|
|
|
Figure 21.8
The Employee Information form. |
|
|
|
|
|
|
|
|
Inside the Edit button on the Employee List form, you would expect the code to look something like this: |
|
|
|
 |
|
|
|
|
Sub cmdEdit_Click ()
' Display the Employee Form
frmEmployee.Show
End Sub |
|
|
|
|
|
|
|
|
If you click the first employee and execute this code, the form displays with that employees information in it. However, if you come back to the list box, click another employee, and execute this code again, you simply redisplay the same screen with the old employee information. This is because Visual Basic determines that this form is already loaded and displayed, and it will simply give this form focus. The Form_Load() event does not occur again, and thats where the text boxes for the form are initialized with the appropriate data: |
|
|
|
 |
|
|
|
|
Private Sub Form_Load()
Call FormShow
End Sub |
|
|
|
|
|